package ua.eug.airv1;

import ua.eug.airv1.utils.Config;

import com.badlogic.gdx.assets.AssetManager;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.graphics.g2d.TextureRegion;

public class ImageProvider {

	final static String TextureName = "4-maptmp.atlas";
	
	private static AssetManager assets = new AssetManager();
	private static TextureAtlas myAtlas;
	
	public static int NLANDS = 6;
	public static TextureRegion Lands[] = new TextureRegion[NLANDS];
	public static TextureRegion Boom[] = new TextureRegion[Config.ExplosionSteps];
	public static TextureRegion Airfield[] = new TextureRegion[2];
	public static TextureRegion Arrow;
	public static TextureRegion FogOfWar;
	public static TextureRegion Cursor;
	public static TextureRegion test;

	public static void Load () {
    	assets.load(TextureName, TextureAtlas.class);
    	assets.finishLoading();
    	myAtlas = assets.get(TextureName, TextureAtlas.class);
    	
		for(int i = 0; i< NLANDS; i++) {
			Lands[i] = FindRegion("tile", i+1);
		} 

		for(int i = 0; i< Config.ExplosionSteps; i++) {
			Boom[i] = FindRegion("boom", i+1);
		} 

		Arrow = FindRegion("arrow");
		FogOfWar = FindRegion("fog");
		Cursor = FindRegion("cursor");
		Airfield[0] = FindRegion("airfield",1);
		Airfield[1] = FindRegion("airfield",2);
		
		test = FindRegion("missile", 1);
	}
	
	public static TextureRegion FindRegion(String name) {
		return myAtlas.findRegion(name);
	}

	public static TextureRegion FindRegion(String name, int index) {
		return myAtlas.findRegion(name, index);
	}

}
